<template>
  <!-- 顶部导航 -->
  <div class="top-nav">
    <el-menu :default-active=$route.path router mode="horizontal">
      <el-menu-item v-for="(item, i) in tabitem" :key="i" :index="item.path">
        {{ item.name }}
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "TopNav",
  props: {
    tabitem: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {
      defaultActive: '',
    };
  },
  // created(){
  //   this.defaultActive = "/" + this.$route.path.split("/")[1]+"/"+this.$route.path.split("/")[2];
  //   console.log(this.defaultActive);
  // }

};
</script>

<style lang="less" scoped>
.el-menu{
  border: 0;
}
.el-menu-item{
  color: #303133;
  height: 45px;
  line-height: 45px;
  font-size: 16px;
}
.el-menu--horizontal>.el-menu-item.is-active {
    border-bottom: 3px solid #5292fe;
    // font-weight: 700;
    font-size: 18px;
    color: #5292fe;
}
</style>
